/*
 *  VortSymmetryPlane.cpp
 *  VortPan
 *
 *  Created by Gregor Veble on 7/15/10.
 *  Copyright 2010  . All rights reserved.
 *
 */

#include "VortSymmetryPlane.h"

using namespace VortPan;

VortSymmetryPlane::VortSymmetryPlane(Vector3D Point, Vector3D Normal){
	SetParams(Point,Normal);
}

VortSymmetryPlane::~VortSymmetryPlane(){
}

void VortSymmetryPlane::SetParams(Vector3D Point, Vector3D Normal){
	SymmetryPoint=Point;
	SymmetryNormal=Normalize(Normal);
	ReflectionMatrix=IdentityMatrix()+(-TWO)*Tensorial(SymmetryNormal, SymmetryNormal);
}

Matrix3D& VortSymmetryPlane::GetReflectionMatrix(){
	return ReflectionMatrix;
}


Vector3D VortSymmetryPlane::Reflect(const Vector3D& Point){
	Vector3D R=Point-SymmetryPoint;
	return SymmetryPoint+R-TWO*(R*SymmetryNormal)*SymmetryNormal;
}

Vector3D VortSymmetryPlane::Mirror(const Vector3D& Normal){
	return Normal-TWO*(Normal*SymmetryNormal)*SymmetryNormal;	
}


re VortSymmetryPlane::PlaneDistance(const Vector3D& Point){
	return SymmetryNormal*(Point-SymmetryPoint);
}

